package com.yan.test3;

import java.util.HashMap;
import java.util.Scanner;
import java.util.Set;

/**
 * @author taoge
 * @Date 2024/8/4 16:08
 * @Description
 */
public class Test3 {
    public static void main(String[] args) {
        HashMap<String , Integer> map = new HashMap<>();
        map.put("zhang3" , 22);
        map.put("li4" , 23);
        map.put("wang5" , 24);
        Set<String> keySet = map.keySet();
        for (String s : keySet) {
            System.out.println(s +"=" + map.get(s));
        }
        System.out.println("输入要修改的名字");
        String next = new Scanner(System.in).next();
        for (String s : keySet) {
            if(next.equals(s)){
                System.out.println("输入要修改的值");
                int i = new Scanner(System.in).nextInt();
                map.put(s , i);
                return;
            }else{
                System.out.println("查无此人");
            }
        }

    }

}
